package com.fanyafei.messagetouch.controller;

import com.fanyafei.messagetouch.domain.SmsParam;
import com.fanyafei.messagetouch.script.TencentSmsScript;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;

/**
 * @author fanyafei@sensedeal.ai
 * @date 2021/11/29
 */
@RestController
public class SendController {

    @Autowired
    private TencentSmsScript tencentSmsScript;

    @GetMapping("/sendSmsV2")
    public String sendSmsV2(String phone) {

        SmsParam smsParam = SmsParam.builder()
                .phones(new HashSet<>(Arrays.asList(phone)))
                .content("520520")
                .build();

        return tencentSmsScript.send(smsParam);
    }
}
